#ifndef _XIU9011_PROTO_TYPE_H_
#define _XIU9011_PROTO_TYPE_H_

// DEVICE_CONTEXT
typedef struct _DEVICE_CONTEXT {
	PUSB_CONFIGURATION_DESCRIPTOR	ConfigurationDescriptor;
	USHORT							wTotalLength;
	WDFUSBDEVICE                    WdfUsbTargetDevice;
	WDFUSBPIPE						BulkReadPipe;
	WDFUSBPIPE						BulkWritePipe;
	RING_BUF                        rb;
} DEVICE_CONTEXT, *PDEVICE_CONTEXT;

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT,GetDeviceContext)

// WORKITEM_CONTEXT
typedef struct _WORKITEM_CONTEXT {
    WDFDEVICE       Device;
    WDFUSBPIPE      Pipe;
} WORKITEM_CONTEXT, *PWORKITEM_CONTEXT;

WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(WORKITEM_CONTEXT, GetWorkItemContext)

// Declare
extern DRIVER_INITIALIZE DriverEntry;

EVT_WDF_DEVICE_CONTEXT_CLEANUP EvtDriverContextCleanup;
EVT_WDF_DEVICE_PREPARE_HARDWARE EvtDevicePrepareHardware;

EVT_WDF_IO_QUEUE_IO_READ EvtIoRead;
EVT_WDF_IO_QUEUE_IO_WRITE EvtIoWrite;
EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL EvtIoDeviceControl;

EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtRequestReadCompletionRoutine;
EVT_WDF_REQUEST_COMPLETION_ROUTINE EvtRequestWriteCompletionRoutine;

extern NTSTATUS EvtDeviceAdd(
    IN WDFDRIVER       Driver,
    IN PWDFDEVICE_INIT  DeviceInit
    ); 
    
extern NTSTATUS XIU9011_EvtDeviceD0Entry(
    IN WDFDEVICE  Device,
    IN WDF_POWER_DEVICE_STATE  PreviousState
    );
    
extern NTSTATUS XIU9011_EvtDeviceD0Exit(
    IN WDFDEVICE  Device,
    IN WDF_POWER_DEVICE_STATE  TargetState
    );

extern NTSTATUS XIU9011_EvtDevicePrepareHardware(
    IN WDFDEVICE Device,
    IN WDFCMRESLIST ResourceList,
    IN WDFCMRESLIST ResourceListTranslated
    );
    
extern NTSTATUS XIU9011_GetConfiguratonDescriptor(
	IN WDFDEVICE  		Device,
	IN PDEVICE_CONTEXT	DeviceContext
    );
    
extern VOID XIU9011_InitializePipeInformation(
    IN WDFDEVICE Device,
    IN PDEVICE_CONTEXT DeviceContext,
    IN WDFUSBINTERFACE UsbInterface,
    IN UCHAR NumberConfiguredPipes
    );

extern NTSTATUS XIU9011_EvtDeviceReleaseHardware(
    IN WDFDEVICE Device,
    IN WDFCMRESLIST ResourceListTranslated
    );

extern VOID XIU9011_EvtDeviceSurpriseRemoval(
    IN WDFDEVICE  Device
    );
    
extern VOID XIU9011_EvtDeviceFileCreate(
    IN WDFDEVICE            Device,
    IN WDFREQUEST           Request,
    IN WDFFILEOBJECT        FileObject
    );
    
extern VOID XIU9011_EvtFileClose(
    IN WDFFILEOBJECT  FileObject
    );

extern VOID XIU9011_EvtIoRead(
    IN WDFQUEUE         Queue,
    IN WDFREQUEST       Request,
    IN size_t           Length
    );

extern VOID XIU9011_EvtIoWrite(
    IN WDFQUEUE         Queue,
    IN WDFREQUEST       Request,
    IN size_t           Length
    );

extern VOID XIU9011_EvtIoDeviceControl(
    IN WDFQUEUE   Queue,
    IN WDFREQUEST Request,
    IN size_t     OutputBufferLength,
    IN size_t     InputBufferLength,
    IN ULONG      IoControlCode
    );
    
#endif
